package yf.mall.entity;


import lombok.Setter;
import lombok.Getter;
import java.io.Serializable;
import java.util.Date;

import java.math.BigDecimal;

/**
 * 团购发起实体
 * 表名 goods_group
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Sun Sep 25 10:29:46 CST 2022
 */
@Setter
@Getter
public class GoodsGroupEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    //
    private Long id;
        //用户Id
    private Long userId;
        //产品名
    private String goodsName;
        //产品ID
    private Long goodsId;
        //用户编号
    private String userCode;
        //用户名字
    private String userName;
        //IMG-微信二维码
    private String userWxQr;
        //利润
    private String profit;
        //数量
    private Integer number;
        //数量
    private Integer amount;

    private String title;

    public BigDecimal getShareProfit(){
        if(this.profit==null||this.profit.equals("")||this.profit.split("_").length<2){
            return  BigDecimal.ZERO;
        }
        return new BigDecimal(this.profit.split("_")[1]);
    }

    public BigDecimal getTeamProfit(){
        if(this.profit==null||this.profit.equals("")||this.profit.split("_").length<1){
            return  BigDecimal.ZERO;
        }
        return new BigDecimal(this.profit.split("_")[0]);
    }
    
    public GoodsGroupEntity(){

    }

    public GoodsGroupEntity(Long userId, String goodsName, Long goodsId, String userCode, String userName, String title) {
        this.userId = userId;
        this.goodsName = goodsName;
        this.goodsId = goodsId;
        this.userCode = userCode;
        this.userName = userName;
        this.title = title;
    }
}
